package com.ruoyi.back.domain

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableLogic
import com.baomidou.mybatisplus.annotation.TableName
import com.ruoyi.back.enums.UserStatusEnum
import com.ruoyi.back.enums.UserTypeEnum
import org.springframework.format.annotation.DateTimeFormat
import java.util.*
import javax.persistence.*

@TableName("fly_app_user")
@Entity
@Table(name = "fly_app_user")
data class AppUser(

    /**
     * 自增id
     */
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    var id: Long? = 1L,

    /**
     * 用户id
     */
    var userId: String? = null,

    /**
     * 密码
     */
    var password: String? = null,

    /**
     * 用户名
     */
    var username: String? = null,

    /**
     * 头像
     */
    var headUrl: String? = null,

    /**
     * 三方code
     */
    var code: String? = null,

    /**
     * 用户类型
     */
    var userType: Int? = UserTypeEnum.NORMAL.code,

    /**
     * 注册日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var registerDate: Date? = Date(),

    /**
     * 来源渠道
     */
    var source: String? = null,

    /**
     * 登录方式
     */
    var loginType: Int? = null,

    /**
     * 最后登录日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var lastLoginDate: Date? = null,

    /**
     * 用户状态
     */
    var status: Int? = UserStatusEnum.NORMAL.code,

    /**
     * 换脸使用次数
     */
    var changeFaceRemainCount: Int? = 0,

    /**
     * 单次换脸次数
     */
    var singleChangeFaceCount: Int? = 0,

    /**
     * 总换脸次数
     */
    var totalChangeFaceCount: Int? = 0,

    /**
     * 换脸单位 1.次 2.分钟
     */
    var receiveUnit: Int? = null,


    /**
     * 手机号码
     */
    var phoneNum: String? = null,

    /**
     * 首次安装时间
     */
    var firstInstallationData: String? = null,

    /**
     * 单次视频支付
     */
    var singleVideoPay: Boolean? = false,

    /**
     * 单次图片支付
     */
    var singlePicPay: Boolean? = false,

    /**
     * 推广注册用户
     */
    var promotionalRegistrationUser: Boolean? = false,

    var year: Int? = null,

    var month: Int? = null,

    var day: Int? = null,

    var hour: Int? = null,

    /**
     * 逻辑删除
     */
    @TableLogic
    var deleted: Int? = 0
)
